﻿@model TestOnlineProject.Models.Entities.TestModel
@{
    ViewBag.Title = "Quick Test Result";
}
<div class="site_map">
    @Html.ActionLink("Home", "Index", "Home")
    / @Html.ActionLink("Subjects", "Index", "Subject")
    / @Html.ActionLink((string)ViewBag.Subject.Code, "Details", "Subject", new { id = ViewBag.Subject.SubjectId }, null)
    / @Html.ActionLink("Tests", "Index", "Test", new { subjectId = ViewBag.Subject.SubjectId }, null)
    / Quick Test Result
</div>
<br />
<div class="main_nav">
    <span><a href="@Url.Content("~/Test/Index")?subjectId=@ViewBag.Subject.SubjectId">
        <img src="@Url.Content("~/Images/back button.png")" />
    </a></span>
</div>
<br />
@{
    if (Model != null)
    {
        <table id="top" class="table">
            <tr>
                <td style="font-weight: bold">
                    You have completed the Quick Test.
                </td>
            </tr>
            <tr>
                <td>
                    <div><span>Subject: @ViewBag.Subject.Name</span></div>
                </td>
            </tr>
            <tr>
                <td>
                    <div><span>Total Questions in Section: @Model.NumberOfQuestions</span></div>
                </td>
            </tr>
            <tr>
                <td>
                    <div>
                        <span>Start Time: @Html.DisplayFor(model => model.StartTime)</span>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div>
                        <span>Finish Time: @Html.DisplayFor(model => model.FinishTime)</span>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div><span>Duration: @ViewBag.Minutes minutes @ViewBag.Seconds seconds</span></div>
                </td>
            </tr>
            <tr>
                <td>
                    <div><span style="font-weight: bold">Number of Questions that you do: @Model.Questions.Count</span></div>
                </td>
            </tr>
            <tr>
                <td>
                    <div><span>Your Marks: @Math.Round(Model.Mark/100,2) / @Model.Questions.Count (@(Math.Round(Model.Mark / (Model.Questions.Count * 10), 2))/10)</span></div>
                </td>
            </tr>
            <tr>
                <td>
                    @if ( (Math.Round(Model.Mark / (Model.Questions.Count * 10), 2)) < 5)
                    {
                        <div><span style="font-weight: bold">Sorry, you are failed! Learn hard and try again!</span></div>
                    }
                    else
                    {
                        <div><span style="font-weight: bold">Congratulation, you are passed!</span></div>
                    }
                </td>
            </tr>
            <tr>
                <td>
                    <span style="padding-right: 30px">Do you want to do The Test again?</span>
                    <span style="padding-right: 30px">
                        @Html.ActionLink("Test again", "QuickTest", "Test", new { sectionId = ViewBag.Section.SectionId }, new { @class = "btn" })
                    </span>
                    <span>
                        @Html.ActionLink("Not now", "Index", "Test", new { subjectId = ViewBag.Subject.SubjectId }, new { @class = "btn" })
                    </span>
                </td>
            </tr>
        </table>
    }
}